package com.example.controller;

import com.example.entity.History;
import com.example.service.HistoryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import com.example.common.Result;
import java.util.List;

@RestController
@RequestMapping("/history")
public class HistoryController {

    @Resource
    private HistoryService historyService;

    @GetMapping("/selectAll")
    public Result selectAll(History history){
        List<History> historyList = historyService.selectAll(history);
        return Result.success(historyList);
    }

    @PostMapping("/update")
    public Result update(@RequestBody History history){
        historyService.update(history);
        return Result.success();
    }

    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Integer id){
        historyService.delete(id);
        return Result.success();
    }
}
